The following was typed up a bit back during one of my projects--
I did clean it up some, because my initial "jot down" was as I went and well, good thing it wasn't on paper.
Disclaimer: This could probably use more of an edit, but until then...
Where will my project live?
$ cd /vagrant/src
ex:
if opening up fresh terminal window (as in my local machine):
$ cd ~/Desktop/vagrant
and RUN vagrant
START:
vagrant up
STOP:
vagrant halt
Create a new project/app that uses postpres
$ rails new SITENAME --database=postgresql
NOTE:
If you run this and it tells you rails is not installed or something along those lines-- is vagrant up? are you in the correct terminal within environment?
NOTE:
Make sure vagrant is running/ run vagrant, open vagrant terminal window and try again.
Open project in text editor (ex: Sublime)
Open database.yml
username: postgres
password: password
host: localhost
NOTE:
above would be for development, test, and production
be careful-- double check database adapter-- should say postgresql
file is whitespace sensitive^^
I add above info in database file under default--
if you look at the file under dev, test, and prod you can tell they are inheriting from the default section-- instead of typing it out 3x I just input it 1x
Make sure you are in the project directory
CREATE intial database
$ rake db:create:all
START SERVER
$ rails s OR $ rails s -b 0.0.0.0
Check localhost web page -- you should be greeted with a welcome aboard page ex: http://localhost:3030/
ERROR:
Checking terminal, error saying could not create DB
Upon rechecking I noticed I left username/pw under production
NOTE: all 3 should match with info from above
SETUP GIT
$ git init .
$ git add --all
$ git commit -am "initial commit"
SETUP GITHUB
GO to Github
NEW REPO button
NAME it, leave PUBLIC button
NOTE: DO NOT check initialize readme (default will get generated ready to be edited with specific project info)
CREATE REPO button
AFTER page reloads "Push existing repo from command line..."
NOTE:
SSH will use pw already setup, https will require username/pw each push
COPY/PASTE:
git remote add...
AND THEN, git push...
IN TERMINAL
NOTE: Each command will populate info specific to github acct
HEROKU
gem 'rails_12factor', group: :production
NOTE: above goes in gem file
UPDATE: above gem is not needed with Rails 5 :)
$ bundle install
NOTE:
Installing the above gem
UPDATE production config file
config/env/production.rb
CHANGE line
"Do not fallback to assets pipeline if precompile asset is missed"
config.assets.compile = false
into =>
"DO fallback to assets pipeline if precompile asset is missed"
config.assets.compile = true
NOTE: remember to back up/ push up code to github with any major changes
$ heroku create APP NAME
$ git push heroku master
NOTE: URL by "launching..." is heroku url
BUT, if you visit site at this time--
you'll be greeted with "the page you were looking for doesn't exist" --
why?
because... page hasn't been built yet :)
BASIC SETUP COMPLETE :)
Grab your wireframe or go create one and get jammin'